﻿using System;
using System.Linq;
using System.Web;
using Fuse8.DomainFramework.Common.Locator;
using Fuse8.GlobalizationFramework.BusinessServices;
using Microsoft.Practices.Unity;
using NUnit.Framework;

namespace UnitTests.IntegrationTests
{
    [TestFixture]
    [Explicit("It is integration tests")]
    public class ResourceServiceTests
    {
        [TestFixtureSetUp]
        public void SetUp()
        {
            IUnityContainer container = new UnityContainer();
            var locator = new UnityServiceLocatorWithLazy(container);
            DependencyServiceLocator.SetLocatorProvider(() => locator);
            HttpContext.Current = new HttpContext(new HttpRequest("default.aspx", "http://localhost/", ""), new HttpResponse(new TextMessageWriter()));
        }

        [Test]
        public void FindValue_KeyValue_AllShouldWork()
        {            
            string value = ResourceService.FindValue("test-key", "test value");
            Assert.AreEqual("test value", value);
        }

        [Test]
        public void AdminFindAll_WithDefualt_AllShouldWork()
        {
            var list = AdminResourceService.FindAll().ToList();
            Console.WriteLine(list.Count);      
        }        
    }
}
